<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>{$head[title]}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta content="{$head[keywords]}" name="keywords" />
<meta content="{$head[description]}" name="description" />
<base href="{SITE_URL}" />
<link href="favicon.ico" rel="shortcut icon" />
<link href="../skin/style.css" rel="stylesheet" type="text/css" />
<link href="{SKIN_PATH}modal.css" rel="stylesheet" type="text/css" />
<link rel="alternate" type="application/rss+xml" title="{$head[title]}" href="/rss.php?rssid={$catid}" />
<script language="JavaScript" src="misc/config.js"></script>
<script language="JavaScript" src="misc/jquery.min.js"></script>
<script language="JavaScript" src="misc/common.js"></script>
<script language="JavaScript" src="misc/validator.js"></script>

<script type="text/javascript" src="misc/validator.js"></script>

<link href="{SKIN_PATH}modal.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="misc/validator.js"></script>
</head>
<body>

{template 'header.html'}

<div class="container">
	
    <div class="main">
    	
        <div class="mod">
            <div class="head">积分兑换</div>
            <div class="body">
                <form name="myform" method="post" action="{$M[url]}changecredit.php">
                <input type="hidden" name="toappid" id="toappid" />
                <input type="hidden" name="tocreditid" id="tocreditid" require="true" datatype="require" msg="请选择需要兑换的对象" msgid="toid" />
                <table cellpadding="0" cellspacing="1" class="table_form">
                    <tr id="point">
                        <th width="20%"><strong>目前您的积分数：</strong></th>
                        <td>{$_point}</td>
                    </tr>
                    <tr id="amount" style="display:none;">
                        <th width="20%"><strong>目前您的金钱数：</strong></th>
                        <td>{$_amount}</td>
                    </tr>
                    <tr>
                        <th width="20%"><strong>支出：</strong></th>
                        <td>
                            <input type="text" name="fromcredit" id="fromcredit" require="true" datatype="require|number|ajax" url="{$M[url]}changecredit.php?action=checkcredit" param="" msg="支出不能为空！|支出格式必须为整数|" msgid="err" /> 
                             <?=form::select($creditsrcOption, 'fromcreditid', 'fromcreditid')?>
                            <span id="err"></span>
                        </td>
                    </tr>
                    <tr>
                        <th><strong>兑换为：</strong></th>
                        <td>
                            <?=form::select($arr_select, 'tocreditname', 'tocreditname')?><span id="toid"></span>
                        </td>
                    </tr>
                    <tr>
                        <th><strong>登录密码：</strong></th>
                        <td><input type="password" name="password" require="true" datatype="limit" min="6" max="16" msg="密码不得少于6个字符或超过16个字符！" /></td>
                    </tr>
                    <tr>
                        <th></th>
                        <td>
                            <input type="submit" name="dosubmit" value="确定" />
                            <input type="reset" name="reset" value=" 重置 " />
                        </td>
                    </tr>
                </table>
                </form>
            </div>
        </div> 
    </div>
    
    <div class="aside">
    	{template "left.html", "member"}
    </div>
</div>



{template 'footer.html'}
<script language="javascript">
$().ready(function() {
	$('form').checkForm(1);
});

$('#fromcreditid').change(function(){
	if($('#fromcreditid').val() == 1)
	{
		$('#point').show();
		$('#amount').hide();
	}
	else if($('#fromcreditid').val() == 2)
	{
		$('#point').hide();
		$('#amount').show();
	}
});

$('#fromcredit').blur(function() {
	var fromcreditid = $('#fromcreditid').val();
	var param = 'fromcreditid=' + fromcreditid;
	$('#fromcredit').attr('param', param);
});

$('#tocreditname').change(function() {
	var value = $('#tocreditname').val();
	var arr = value.split('|');
	if(arr[1] != 'undefined')
	{
		$('#toappid').val(arr[0]);
		$('#tocreditid').val(arr[1]);
	}
});
</script>